let onClickDocument =(e) => {
  let {target} = e;
  callbacks.forEach(item=>{
    if(target === item.el || item.el.contains(target)){

    }else{
      item.callback()
    }
  })
}
document.addEventListener('click', onClickDocument);
let callbacks = [];
export default {
  //bin执行时 el还没有插入页面
  bind:function(el,binding,vnode){
    callbacks.push({el,callback:binding.value});
    /*document.addEventListener('click', (e) => {
      let {target} = e;
      if(target === el || el.contains(target)){
        console.log('inside');
        return
      }
      binding.value();
    });*/
  }
}
let removeListener = () => {
  document.removeEventListener('click', onClickDocument);
};

export {removeListener};

